<?php

namespace App\Modules\Setting;

use App\Modules\AdapterApi;
use App\Services\Setting\SettingIndex;

class SettingCategory extends AdapterApi
{

    /*为某应用添加一个分类*/
    public function addCategory(): array
    {
        $data = pick_array($this->postData, ['name','action', 'token']);

        return SettingIndex::SettingCategory()->addCategory($data);
    }

    /*编辑一个分类*/
    public function editCategory(): array
    {
        $data = pick_array($this->postData, ['other_app_read','is_public','id','name','action','order']);

        return SettingIndex::SettingCategory()->editCategory($data);
    }

    /*获取分类树*/
    public function getTree(): array
    {
        $data = pick_array($this->postData, ['id']);

        return SettingIndex::SettingCategory()->getTree($data);
    }

    /*查看某个分类详情*/
    public function oneCateInfo(): array
    {
        $data = pick_array($this->postData, ['id']);

        return SettingIndex::SettingCategory()->oneCateInfo($data);
    }

    /*删除某个分类*/
    public function delOneCate(): array
    {
        $data = pick_array($this->postData, ['id']);

        return SettingIndex::SettingCategory()->delOneCate($data);
    }

    /*批量删除选中的分类*/
    public function batchDelCate(): array
    {
        $data = pick_array($this->postData, ['id']);

        return SettingIndex::SettingCategory()->batchDelCate($data);

    }

    /*启用/禁用 一个 分类*/
    public function changeStatus(): array
    {
        $data = pick_array($this->postData, ['id','status']);

        return SettingIndex::SettingCategory()->changeStatus($data);
    }

    /*启用/禁用 多个 分类*/
    public function batchChangeStatus(): array
    {
        $data = pick_array($this->postData, ['id','status']);

        return SettingIndex::SettingCategory()->batchChangeStatus($data);
    }

}
